<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>exp4-3</title>
    <style type="text/css">
    tr:first-child,
    td:first-child {
        color: red;
        font-weight: bold;
        font-size: 20px;
    }

    td {
        width: 70px
    }

    div table {
        width: 700px;
        margin: 0 auto;
    }

    table {
        text-align: center;
        vertical-align: middle;
    }

    table,
    td,
    th {
        border: 1px solid black;
    }

    table {
        border-collapse: collapse;
    }
    </style>
</head>

<body>
    <div>
        <table>
            <caption>
                <h1 align="center">乘法口诀表</h1>
            </caption>
            <?php
				echo "<tr><th> × </th>";
				for ($j = 1; $j<=9; $j++){         
					echo "<th>{$j}</th>";       
				}      
				echo "</tr>";
				for ($i=1; $i <=9; $i++){
					echo "<tr>";
					echo "<td> {$i} </td>";

					for ($j=1; $j<=$i; $j++){
						echo "<td>{$i}×{$j}=" . $i*$j . "</td>";
					}

					for ($j=$i+1; $j<=9; $j++){
						echo "<td>&nbsp;</td>";
					}
					echo "</tr>";
				}
			?>
        </table>
    </div>
</body>

</html>